define(["app","js/services/MuseService",'js/services/MessageBox'],
    function (app) {
        var deps = ["$scope", "$http", "$rootScope", "$filter", "$state", "$stateParams","MuseService","MessageBox"];

        function controller($scope, $http, $rootScope, $filter, $state, $stateParams,MuseService,MessageBox) {
            $scope.curUser = getSessionJson('curUserObj');

            if(isEmpty($scope.curUser)){
                var url = 'admin.html';
                location.replace(url);
            }

            $scope.ownerList =[];
            $scope.driver = {};
            $scope.type = "";


            $scope.btnClick = function(type){
                $scope.type = type;
            }

            $scope.getdriverList = function () {

                MuseService.post('check/getDriverList',{}).success(
                    function(data){
                        if (data.code == 0) {
                            $scope.ownerList = data.data;
                        } else {
                            MessageBox.error('错误：' + data.msg);
                        }
                    }
                )

            };

            $scope.getdriverList();


            $scope.checkDriver = function (vo,type) {

                MuseService.post('check/checkDriver',{id:vo.id,type:type}).success(
                    function(data){
                        if (data.code == 0) {
                            MessageBox.notify("提交成功！");

                            vo.isEffect = type;
                        } else {
                            MessageBox.error('错误：' + data.msg);
                        }
                    }
                )

            };
            // 取消，返回
            $scope.close = function () {
                history.back();
            };
        }

        controller.$inject = deps;
        app.lazy.controller("DriverCheckController", controller);
    });